package com.zy.controller;

import com.zy.vo.ResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobaExceptionCatch {
    /**
     * 全局异常捕捉处理
     * @param ex
     * @return
     */
    @ExceptionHandler(RuntimeException.class)
    public ResultVo errorHandler(Exception ex) {
        log.error(ex.getMessage(),ex);
        return ResultVo.fail("查询操作失败!");
    }
}
